<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>创建对象</title>
	</head>
	<body>
		<script>
		//创建数组两种方法
		var arr=[3,56,5];
		var arr2=new Array('apple','banana');
		
		//创建独享有2种方式
		//1.字面量，“名/值” 对，用逗号分隔
		var person={
			name:'pty',
			age:28,
			sayHi:function(){console.log("Hello JS")}
		};
		console.log(person.name);
		console.log(person['age']);
		person.sayHi();
		
		//2 new创建对象：动态添加属性和方法
		var cat=new Object();
		cat.color='black';
		cat.name='litty';
		cat.fun=function(){
			 console.log("吃鱼");
		};
		</script>
	</body>
</html>
